<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Admin_config extends MY_Controller {

	function Admin_config()
	{
		parent::MY_Controller();
        parent::check_admin_login();
	}

	function index_config(){
		$this->load->model('Mconfigs');
		$configs = $this->Mconfigs->get_index_configs();
		//print_r($configs);exit;
		$this->template->view('admin/index_config',array('config'=>$configs));
	}

	function config_update(){
		$configs = $this->input->post('configs');
		//print_r($configs);exit;
		$values = $this->input->get_data($configs);
		$this->load->model('Mconfigs');
		if ($this->Mconfigs->update_configs($values)){
			echo '修改成功！';
		} else {
			echo '修改失败';
		}
	}

	function banus_admin(){
		$this->load->model('Mconfigs');
		if($this->input->post('action') == 'edit'){
			$configs = $this->input->post('configs');
			//print_r($configs);exit;
			$values = $this->input->get_data($configs);
			if ($this->Mconfigs->update_configs($values)){
				echo '修改成功！';
			} else {
				echo '修改失败';
			}
		}
		$configs = $this->Mconfigs->get_config();
		//print_r($configs);exit;
		$this->template->view('admin/banus_config',array('config'=>$configs));
	}


}
?>